﻿// AtlObject.cpp: CAtlObject 的实现

#include "pch.h"
#include "AtlObject.h"
#include <stdio.h>
#include <tchar.h>

// CAtlObject

STDMETHODIMP CAtlObject::Test()
{
    //
    //  创建类实例，不会增加引用计数
    //

    CComObject<CAtlObject>* lpObject;
    CComObject<CAtlObject>::CreateInstance(&lpObject);

    //
    //  获取接口，会增加引用计数
    //

    IUnknown* lpIUnknown;
    CComCreator<CComObject<CAtlObject>>::CreateInstance(nullptr,
        IID_IUnknown, (void**)&lpIUnknown); //  会增加引用计数

    CAtlObject::_CreatorClass::CreateInstance(nullptr, IID_IUnknown, (void**)&lpIUnknown);

    return S_OK;
}
